<template>
    <div>
        购物车模块
        <ul>
            <li @click="gotoProduct(1, 'hpg1')">购物车商品1</li>
            <li @click="gotoProduct(2, 'hpg2')">购物车商品2</li>
            <li @click="gotoProduct(3, 'hpg3')">购物车商品3</li>
            <li @click="gotoProduct(4, 'hpg4')">购物车商品4</li>
        </ul>
    </div>
</template>

<script setup>
import { useRouter } from "vue-router";
const router = useRouter()
const gotoProduct = (id, type) => {
    router.push({
        name: 'cartproduct',
        query: { id: id, type }
    })
}
</script>

<style scoped></style>